Datasets
Datasets are a powerful feature that enable the data-driven testing by executing the test cases with multiple sets of test data. They provide flexibility for creating the environment-specific datasets and they support to import the test data from the CSV files, which makes the test automation more efficient and maintainable.
Creating Datasets
Import from CSV File
- In a test case, go to the "Datasets" section.
- Click the "Create Dataset" button.
- Select "Import from Local System".
- Provide a name for the dataset.
- Drop your CSV file or click 'Click Here' to upload.
- Click "Create" to import the data.
Manual Creation
- Navigate to the "Datasets" section in your test case.
- Click "Create Dataset" button.
- Select "Create from Scratch".
- Provide a name and click create.
- Add rows and columns using the respective buttons.
- Enter your test data.
- Click Save to store the dataset.
Environment-Specific Datasets
To create an environment-specific variations for your datasets, do these steps below:
- Click "Add" button next to the name.
- Select the environment variable name.
- Assign environment-specific values.
During the execution of the test, if an environment-specific data exists, it will be used or else a default dataset will be taken.
Using Dataset Variables
- In request fields (URL, parameters, headers): Use
{{variable_name}}
. - In scripts: Use
pq.iterationData.get("variable_name")
.
Running Tests with Datasets
There are two methods to execute the test with Datasets as given below:
- On the Dataset page, click on the "Run" button.
- Run the test case normally - variables will be automatically taken from the dataset.
The test will run once for each dataset row, using the row's values as variables.